#
# $Id: Makefile 3478 2012-04-20 10:24:37Z mortens $
#
# (C) Copyright 2012, met.no 
#
# This file is part of the ProRad software system for processing
# radar data
#
# The ProRad software is free software; you can redistribute it
# and/or modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2.1,
# or (at your option) any later version.
#
# ProRad is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with ProRad; see the file COPYING. If not, write to the Free
# Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
# 02111-1307, USA.
#

CC      := gcc

#CCFLAGS := -ggdb -Wall -DDEBUG
CCFLAGS := -Wall

#CCFLAGS += -DZXML

ARFLAGS  := r

# flags to build test
#
LFLAGS   := -lproradie -lxmlsupport -lxml2 -lssl\
	-lradarprodrw -lnrad2h5rw -lhdf5 -lz -lbase64

LIBS     := -L. -L../lib 
INCL     := -I. -I../include  -I/usr/include/libxml2


LIBSRCS  := prorad-ie-checksum-funcs.c prorad-ie-sockwrap.c\
	prorad-ie-messages.c prorad-ie-file-funcs.c\
	prorad-ie-cycles.c


LIBOBJS  := ${LIBSRCS:.c=.o}
LIBHEADS := ${LIBSRCS:.c=.h} 

THELIB   := libproradie.a
THELIBH  := prorad-import-export.h prorad-ie-structs.h


.SUFFIXES :
.SUFFIXES : .c .o .a

.c.o:
	${CC} ${CCFLAGS} -fpic ${INCL} -c $< -o $@


all: ${THELIB}
#	rm -f *.o

${THELIB}: ${LIBOBJS} ${LIBHEADS} ${THELIBH}
	${AR} ${ARFLAGS} $@ ${LIBOBJS}

install: all
	install -m 644 ${THELIB} ../lib
	install -m 644 ${THELIBH} ${LIBHEADS} ../include

test: test.c ${THELIB}
	${CC} ${CCFLAGS} ${INCL} -o $@ $< ${LIBS} ${LFLAGS}


clean:
	rm -f *.o
	rm -f core core.* *~
	rm -f *.a
	rm -f test
